<form class="zscx form-signin" method="post">
    <label for="">证书查询</label>
    <input type="text" name="idcard" placeholder="请输入身份证号码" required/>
    <input type="text" name="auth_sn" placeholder="请输入证书编号" required/>
    <button type="reset">重置</button>
    <button type="submit">开始查询</button>
</form>

<script src="__PUBLIC__/static/index/js/layer.js?v=3.03"></script>
<script>
    $(function () {
        var idcard = $('input[name="idcard"]');
        var auth_sn = $('input[name="auth_sn"]');
        $(".form-signin").find('button:submit').click(function () {
            if ($.trim(idcard.val()) == "") {
                layer.msg("身份证号不能为空！");
                idcard.focus();
                return false;
            } else if ($.trim(auth_sn.val()) == "") {
                layer.msg("证书编号不能为空！");
                auth_sn.focus();
                return false;
            }
            $.post("{:url('@index/index/auth')}", $(".form-signin").serialize()).success(function (data) {
                console.log(data);
                if (data.code == 1) {
                    layer.photos({
                        photos: {
                            "title": "", //相册标题
                            "id": 1, //相册id
                            "start": 0, //初始显示的图片序号，默认0
                            "data": [ //相册包含的图片，数组格式
                                {
                                    "alt": "证书",
                                    "pid": 2, //图片id
                                    "src": data.url, //原图地址
                                    "thumb": "" //缩略图地址
                                }
                            ]
                        },
                        anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
                    });
                } else {
                    layer.msg(data.msg)
                }
            });
            return false;
        });
    });

</script>